#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    int n,sum=0;
    cin>>n;
    vector<int>v(n+1);
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
        sum+=v[i];
    }
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        ans+=v[i]*(sum-v[i]);
    }
    cout<<ans/2<<endl;
}
signed main()
{
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    int T=1;
    //cin>>T;
    while(T--)
    {
       solve();
    }
    return 0;
}